<template>
  <div class="container"><!-- 页面的整体布局 -->
    <div class="row"> <!-- 这一行单独用来放标题 -->
      <div class="col-lg-12"> <!-- 根据 bs规定，所有内容应放在 col 中。这一列占满一行 -->
        <p class="text-center h1"> <!-- text-center 是 bs 中央排版类，h1 是 bs 一号标题类 -->
          智能文档
        </p>
      </div>
    </div>
    <hr><!-- 标题和真正内容的分割线 -->
    <div class="row"><!-- 这一行用来放置主要内容 -->
      <div class="col-lg-6"><!-- 代码输入部分 -->
        <!--<p id="run" class="text-center h3">-->
        <!--请输入-->
        <!--</p>-->
        <div class='text-right'>
          <button type="button" class="btn btn-primary " @click="encode()">加密</button>

          <button type="button" class="btn btn-primary " @click="decode()">解密</button>
        </div>
        <textarea id="code" placeholder="Your code here." class="form-control" v-model="inputtext"></textarea>

      </div>
    </div>
  </div>
</template>


<script>
  import config from "../config"

  export default {
    name: "index",
    data() {
      return {
        input: " ",
        result: " ",
        inputtext: " ",
        response: " ",
        re_msg: "",
        correct: "",
        fal: ""
      };
    },
    mounted() {

    },
    computed: {},
    created() {

    },
    methods: {
      async encode() {
        var res = await this.$http.get(config.sendEnCode, {
          params: {
            test_string: this.inputtext //相关参数
          }

        });
        console.log(res);
        this.inputtext = res.data.data.test_string;
      },
      async decode() {
        var res = await this.$http.get(config.sendDeCode, {
          params: {
            test_string: this.inputtext //相关参数
          }

        });
        console.log(res);
        this.inputtext = res.data.data.test_string;
      }

    },
    components: {}
  }

</script>

<style scoped>
  #run {
    width: 20%; /*规定按钮的宽度*/
    margin-top: 10px; /*留出和输入框的间距*/
  }

  #code {
    font-size: 25px;
    resize: none;
  }

  .form-control {
    border: 1px solid black;
    min-width: 776px;
    min-height: 432px;
  }

</style>
